import QtQuick 2.15
import QtQuick.Controls 2.15
import QtLocation 5.15
import QtPositioning 5.15
import QtQuick.Dialogs 1.3

import MGroundControl 1.0
import MGroundControl.ScreenTools 1.0


Map {
    id: _map
    gesture.acceptedGestures: MapGestureArea.PinchGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture
    gesture.flickDeceleration: 3000
    anchors.fill: parent
    plugin: Plugin {
        name: "MGroundControl"
        PluginParameter{
            name: "mapping.cache.directory"
            value: "/tmp"
        }
    }
    opacity: 0.99

    property string mapName:                        'defaultMap'
    property bool   isSatelliteMap:                 activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1


    function updateActiveMapType() {
        var fullMapName = 'Bing Hybrid'
        console.log(_map.supportedMapTypes.length)
        for (var i = 0; i < _map.supportedMapTypes.length; i++) {
            if (fullMapName === _map.supportedMapTypes[i].name) {
                _map.activeMapType = _map.supportedMapTypes[i]
                return
            }
        }
    }

    Component.onCompleted: {
        updateActiveMapType()
    }
}
